<html lang="en">
<head>
    <meta name="google-signin-scope" content="profile email">
    <meta name="google-signin-client_id" content="707985123880-nmln29q0q11jai8oi37c7kpsah9eqcn4.apps.googleusercontent.com">
    <script src="https://apis.google.com/js/platform.js" async defer></script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
<button onclick="hello('twitter').login()">twitter</button>
<button onclick="hello('google').login()">google</button>
<button onclick="hello('facebook').login()">google</button>
<a href="{{route('third_login',['type'=>'google'])}}">第三方跳转google</a>
<a href="{{route('third_login',['type'=>'facebook'])}}">第三方跳转facebook</a>
<a href="{{route('third_login',['type'=>'twitter'])}}">第三方跳转twitter</a>
{{--<button class="twBtn" onclick="hello('twitter').login()">twitter</button>--}}
</body>
<script src="{{asset('dist/js/hello.js')}}"></script>
<script>
    //    function onSignIn(googleUser) {
    //        // Useful data for your client-side scripts:
    //        var profile = googleUser.getBasicProfile();
    //        console.log("ID: " + profile.getId()); // Don't send this directly to your server!
    //        console.log('Full Name: ' + profile.getName());
    //        console.log('Given Name: ' + profile.getGivenName());
    //        console.log('Family Name: ' + profile.getFamilyName());
    //        console.log("Image URL: " + profile.getImageUrl());
    //        console.log("Email: " + profile.getEmail());
    //
    //        // The ID token you need to pass to your backend:
    //        var id_token = googleUser.getAuthResponse().id_token;
    //        console.log("ID Token: " + id_token);
    //    };


    hello.on('auth.login', function(auth) {

        // Call user information, for the given network
        hello(auth.network).api('me').then(function(r) {
            console.log(r);
            // Inject it into the container
            var label = document.getElementById('profile_' + auth.network);
            if (!label) {
                label = document.createElement('div');
                label.id = 'profile_' + auth.network;
                document.getElementById('profile').appendChild(label);
            }
            label.innerHTML = '<img src="' + r.thumbnail + '" /> Hey ' + r.name;
        });
    });

    hello.init({
        twitter: '4day3Jc6zGH4oLvid12yBxFfN',
        google:'707985123880-nmln29q0q11jai8oi37c7kpsah9eqcn4.apps.googleusercontent.com',
        facebook:'330343927370751'
    }, {redirect_uri: 'https://www.cradyang.com/googlepage'});

</script>
</html>